﻿using PlayerScannerCore.ViewModel;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace PlayerScanner
{
    public class ItemCompactColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var itemViewModel = (ItemViewModel)value;
            var ret = String.Empty;
            var sb = new StringBuilder();

            if (value != null)
            {
                switch (itemViewModel.ItemType)
                {
                case PlayerScannerCore.ItemType.SWeapon:
                    return new SolidColorBrush(Color.FromArgb(255, 255, 120, 120));
                case PlayerScannerCore.ItemType.Weapon:
                    return new SolidColorBrush(Color.FromArgb(255, 255, 255, 200));
                case PlayerScannerCore.ItemType.Armor:
                    return new SolidColorBrush(Color.FromArgb(255, 200, 200, 255));
                case PlayerScannerCore.ItemType.Shield:
                    return new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
                case PlayerScannerCore.ItemType.Unit:
                    return new SolidColorBrush(Color.FromArgb(255, 255, 200, 255));
                case PlayerScannerCore.ItemType.Mag:
                    return new SolidColorBrush(Color.FromArgb(255, 200, 200, 200));
                case PlayerScannerCore.ItemType.Meseta:
                    return new SolidColorBrush(Color.FromArgb(255, 255, 200, 150));
                case PlayerScannerCore.ItemType.TechDisk:
                case PlayerScannerCore.ItemType.Regular:
                default:
                    return new SolidColorBrush(Color.FromArgb(255, 200, 255, 200));
                }
            }

            return ret;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            // Do nothing
            return null;
        }
    }
}
